package com.yx.yinshanjinniu.utils;

import android.content.Context;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;


import androidx.core.content.ContextCompat;

import com.yx.yinshanjinniu.R;

/**
 * 勋章类
 */
public class MedalUtils {

    public static void setUserCenterLevelTag(int level, ImageView iv) {
        if (level == 1) {
            iv.setImageResource(R.drawable.img_level_tag_1);
        } else if (level == 2) {
            iv.setImageResource(R.drawable.img_level_tag_2);
        } else if (level == 3) {
            iv.setImageResource(R.drawable.img_level_tag_3);
        } else if (level == 4) {
            iv.setImageResource(R.drawable.img_level_tag_4);
        } else if (level == 5) {
            iv.setImageResource(R.drawable.img_level_tag_5);
        } else if (level == 6) {
            iv.setImageResource(R.drawable.img_level_tag_6);
        } else if (level >= 7) {
            iv.setImageResource(R.drawable.img_level_tag_7);
        }
    }

    public static void setUserCenterLevelBg(int level, RelativeLayout rl) {
        if (level == 1) {
            rl.setBackgroundResource(R.drawable.ic_level_bg_1);
        } else if (level == 2) {
            rl.setBackgroundResource(R.drawable.ic_level_bg_2);
        } else if (level == 3) {
            rl.setBackgroundResource(R.drawable.ic_level_bg_3);
        } else if (level == 4) {
            rl.setBackgroundResource(R.drawable.ic_level_bg_4);
        } else if (level == 5) {
            rl.setBackgroundResource(R.drawable.ic_level_bg_5);
        } else if (level == 6) {
            rl.setBackgroundResource(R.drawable.ic_level_bg_6);
        } else if (level >= 7) {
            rl.setBackgroundResource(R.drawable.ic_level_bg_7);
        }
    }

    public static void setUserCenterLevelButtonBg(int level, TextView tv) {
        if (level == 1) {
            tv.setBackgroundResource(R.drawable.shape_vip_center_button_1);
        } else if (level == 2) {
            tv.setBackgroundResource(R.drawable.shape_vip_center_button_2);
        } else if (level == 3) {
            tv.setBackgroundResource(R.drawable.shape_vip_center_button_3);
        } else if (level == 4) {
            tv.setBackgroundResource(R.drawable.shape_vip_center_button_4);
        } else if (level == 5) {
            tv.setBackgroundResource(R.drawable.shape_vip_center_button_5);
        } else if (level == 6) {
            tv.setBackgroundResource(R.drawable.shape_vip_center_button_6);
        } else if (level >= 7) {
            tv.setBackgroundResource(R.drawable.shape_vip_center_button_7);
        }
    }

    public static void setUserCenterLevelTitleTag(int level, ImageView iv) {
        if (level == 1) {
            iv.setImageResource(R.drawable.img_level_big_tag_1);
        } else if (level == 2) {
            iv.setImageResource(R.drawable.img_level_big_tag_2);
        } else if (level == 3) {
            iv.setImageResource(R.drawable.img_level_big_tag_3);
        } else if (level == 4) {
            iv.setImageResource(R.drawable.img_level_big_tag_4);
        } else if (level == 5) {
            iv.setImageResource(R.drawable.img_level_big_tag_5);
        } else if (level == 6) {
            iv.setImageResource(R.drawable.img_level_big_tag_6);
        } else if (level >= 7) {
            iv.setImageResource(R.drawable.img_level_big_tag_7);
        }
    }

    public static void setUserCenterLevelTitleColor(Context context, int level, TextView tv){
        if (level == 1) {
            tv.setTextColor(ContextCompat.getColor(context, R.color.color_level_1));
        } else if (level == 2) {
            tv.setTextColor(ContextCompat.getColor(context, R.color.color_level_2));
        } else if (level == 3) {
            tv.setTextColor(ContextCompat.getColor(context, R.color.color_level_3));
        } else if (level == 4) {
            tv.setTextColor(ContextCompat.getColor(context, R.color.color_level_4));
        } else if (level == 5) {
            tv.setTextColor(ContextCompat.getColor(context, R.color.color_level_5));
        } else if (level == 6) {
            tv.setTextColor(ContextCompat.getColor(context, R.color.color_level_6));
        } else if (level >= 7) {
            tv.setTextColor(ContextCompat.getColor(context, R.color.color_level_7));
        }
    }

    public static void setUserCenterLevelProgressColor(Context context, int level, ProgressBar pb){
        if (level == 1) {
            pb.setProgressDrawable(context.getResources().getDrawable(R.drawable.my_progress_bar));
        } else if (level == 2) {
            pb.setProgressDrawable(context.getResources().getDrawable(R.drawable.my_progress_bar_2));
        } else if (level == 3) {
            pb.setProgressDrawable(context.getResources().getDrawable(R.drawable.my_progress_bar_3));
        } else if (level == 4) {
            pb.setProgressDrawable(context.getResources().getDrawable(R.drawable.my_progress_bar_4));
        } else if (level == 5) {
            pb.setProgressDrawable(context.getResources().getDrawable(R.drawable.my_progress_bar_5));
        } else if (level == 6) {
            pb.setProgressDrawable(context.getResources().getDrawable(R.drawable.my_progress_bar_6));
        } else if (level >= 7) {
            pb.setProgressDrawable(context.getResources().getDrawable(R.drawable.my_progress_bar_7));
        }
    }

    public static String getUserLevelName(int level) {
        if (level == 1) {
            return "大众会员";
        } else if (level == 2) {
            return "青铜会员";
        } else if (level == 3) {
            return "白银会员";
        } else if (level == 4) {
            return "黄金会员";
        } else if (level == 5) {
            return "铂金会员";
        } else if (level == 6) {
            return "钻石会员";
        } else if (level >= 7) {
            return "黑钻会员";
        }
        return "大众会员";
    }

    public static String getUserLevelTitle(int level) {
        if (level == 1) {
            return "恭喜您!\r\n已经获得大众会员特权";
        } else if (level == 2) {
            return "恭喜您!\r\n已经获得青铜会员特权";
        } else if (level == 3) {
            return "恭喜您!\r\n已经获得白银会员特权";
        } else if (level == 4) {
            return "恭喜您!\r\n已经获得黄金会员特权";
        } else if (level == 5) {
            return "恭喜您!\r\n已经获得铂金会员特权";
        } else if (level == 6) {
            return "恭喜您!\r\n已经获得钻石会员特权";
        } else if (level >= 7) {
            return "恭喜您!\r\n已经获得黑钻会员特权";
        }
        return "恭喜您!\r\n已经获得大众会员特权";
    }

}
